#pragma once
#include <OgreCamera.h>
#include <OgreEntity.h>
#include <OgreLogManager.h>
#include <OgreRoot.h>
#include <OgreViewport.h>
#include <OgreSceneManager.h>
#include <OgreRenderWindow.h>
#include <OgreConfigFile.h>

#include <OISEvents.h>
#include <OISInputManager.h>
#include <OISKeyboard.h>
#include <OISMouse.h>
#include <OgreNewt.h>
#include "util.h"
#include "Level.h"

using namespace Ogre;
/********************************************************************
	created:	2011/06/14
	created:	14:6:2011   14:10
	file base:	Game
	file ext:	h
	author:		ScaredBird
	purpose:	main class of the application, handles everything
*********************************************************************/
class Game
{
public: 
	void go();
	static Game* getInstance();
private:
	Game(void);
	static Game * instance;
protected:
	//////////////////////////////////////////////////////////////////////////
	//from baseApplication
	virtual bool setup();
	virtual bool configure(void);
	virtual void chooseSceneManager(void);
	virtual void createCamera(void);
	virtual void createFrameListener(void);
	virtual void createScene(void) ; // Override me!
	virtual void destroyScene(void);
	virtual void createViewports(void);
	virtual void setupResources(void);
	virtual void createResourceListener(void);
	virtual void loadResources(void);
	//////////////////////////////////////////////////////////////////////////
	Level*  level;
	State* mainFormState;
	//////////////////////////////////////////////////////////////////////////
protected:
	void initStates();
public:
	void switchState();
public:
	void pickupFromChildState(State* child,int msg);
public: 
	State *welcomeState;
	State *curState;  //the current state
	//////////////////////////////////////////////////////////////////////////
public:
	Ogre::Root *mRoot;
	Ogre::Camera* mCamera;
	Ogre::SceneManager* mSceneMgr;
	Ogre::RenderWindow* mWindow;
	Ogre::String mResourcesCfg;
	Ogre::String mPluginsCfg;
	OgreNewt::World* mWorld;

	bool mCursorWasVisible;                  // was cursor visible before dialog appeared
	bool mShutDown;

	//OIS Input devices
	OIS::InputManager* mInputManager;
	OIS::Mouse*    mMouse;
	OIS::Keyboard* mKeyboard;
	//////////////////////////////////////////////////////////////////////////
	//constructor and destructor
public:
	~Game(void);
	//////////////////////////////////////////////////////////////////////////
	//light for test purpose
	//////////////////////////////////////////////////////////////////////////
	Ogre::Light*l;
};


